﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading;
using Skugo;

namespace Driver
{
    class Animal
    {
        [Property]
        public String Name = "Ted";

        [Property]
        public Int32 Lives = 9;

        [Property]
        public Int32 Width
        {
            get { return this.HalfWidth * 2; }
            set { this.HalfWidth = value / 2; }
        }

        [Property]
        public Single Health = 100.0f;

        [Property]
        public void ResetHealth()
        {
            this.Health = 100.0f;
        }

        [Property]
        public void TakeDamage(Single amount)
        {
            this.Health -= amount;
        }

        private Int32 HalfWidth = 0;
    }

    class Program
    {
        static void Main(string[] args)
        {
            Framework f = Framework.Instance;

            f.Start();

            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();

            var hen = new Animal();

            //Viewport viewport = null;

            PropertyGrid pg = null;

            //TestBed tb = null;

            for (; ; )
            {
                //if (stopwatch.ElapsedMilliseconds / 1000.0f > 5.0f && viewport == null)
                //{
                //    //viewport = f.CreateGlobal<Viewport>();
                //}

                if (stopwatch.ElapsedMilliseconds / 1000.0f > 8.0f && pg == null)
                {
                    pg = f.CreateGlobal<PropertyGrid>();

                    pg.SetSelection(hen);
                }

                //if (stopwatch.ElapsedMilliseconds / 1000.0f > 6.0f && tb == null)
                //{
                //    tb = f.CreateGlobal<TestBed>();
                //}

                f.Update();

                Thread.Sleep(1);
            }

            f.Stop();
        }
    }
}
